﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;

namespace MyToolConsoleApplication
{
    //生成形如"state.xxxx"
    class _20120803_MakeLDUR_fields
    {
        static void Main(string[] args)
        {
            List<string> context_list = new List<string>();

            try
            {
                Console.WriteLine("请输入txt文件路径...");
                using (StreamReader sr = new StreamReader(Console.ReadLine()))
                {
                    string line;
                    while (null != (line = sr.ReadLine()))
                    {
                        context_list.Add(line);
                    }
                }
                Console.WriteLine("读取文件成功！");
                Console.WriteLine();

                Regex regex = new Regex(@"(?<fieldName>[A-Z_]+)(\s+)(?<fieldDesc>.+)");

                foreach (var sdf in context_list)
                {
                    Match match = regex.Match(sdf);
                    Console.WriteLine(string.Format("state.{0},", match.Groups["fieldName"].Value));
                }

            }
            catch (System.Exception ex)
            {
                Console.Write(ex.Message);
            }

            Console.ReadLine();

        }
    }
}
